﻿<BadHabit_WPFTools:ShapedWindow
    x:Name="window"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BadHabit_Factory="clr-namespace:BadHabit.Factory"      
    xmlns:BadHabit_Factory_Controls="clr-namespace:BadHabit.Factory.Controls"      
    xmlns:BadHabit_WPFTools="clr-namespace:BadHabit.WPFTools;assembly=BadHabit.WPFTools"
    xmlns:core="clr-namespace:System;assembly=mscorlib"
    
    xmlns:props="clr-namespace:BadHabit.Factory.Properties"
    
        
    x:Class="BadHabit.Factory.Windows.Main"
    Title="The Scrum Factory"                
    SnapsToDevicePixels="True"
    WindowStyle="None"    
    ResizeMode="CanResizeWithGrip" 
    ShowInTaskbar="True"
    StateChanged="window_StateChanged"
    WindowState="Minimized"
    
    MinWidth="1000"
    MinHeight="500"
    
    
    
    Loaded="window_Loaded"
    
    Icon="/Images/WindowsIcons/Factory.ico"    
    >
    
    <BadHabit_WPFTools:ShapedWindow.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Save" CanExecute="Save_CanExecute" Executed="Save_Executed"/>
        <CommandBinding Command="ApplicationCommands.Undo" CanExecute="Save_CanExecute" Executed="Undo_Executed"/>
        <CommandBinding Command="NavigationCommands.Refresh" CanExecute="Refresh_CanExecute" Executed="Refresh_Executed"/>        
        <CommandBinding Command="BadHabit_Factory:FactoryCommands.ViewTeamAllocation" Executed="ViewTeamAllocation_Executed" />
    </BadHabit_WPFTools:ShapedWindow.CommandBindings>
    
 
        
       
    <Border Style="{StaticResource FactoryMainWindowBorder}" >
        <Grid Name="mainGrid"  >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            
            

            <Border 
                x:Name="PART_TitleBar"
                Style="{StaticResource FactoryWindowTitleBorder}"
                Grid.Row="0"
                Margin="0"
                Padding="0"
                >
                <Grid>
                    <Grid.ColumnDefinitions>                        
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="20"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    
                    <TextBlock 
                            Grid.Column="0" Grid.Row="0"
                           Style="{StaticResource ApplicationTitleTextBlock}"                                               
                           Margin="6,2,0,0"                               
                           Text="Scrum Factory"/>    
                    
                    <StackPanel Grid.Column="1" Grid.RowSpan="2" VerticalAlignment="Center" Orientation="Vertical" ToolTip="Your current team velocity in this month. It means the sum in size of the finished backlog items divided by the sum of hours spent to finish them." Margin="5,0,5,0"  >
                        <TextBlock x:Name="factoryVelocityTextBlock"  Text="0"  FontFamily="Impact" FontSize="18" Foreground="{StaticResource DarkTextBrush}" Margin="0" />
                        <TextBlock  Text="{x:Static props:Resources.pts_hrs}"  FontFamily="Impact" FontSize="8" Foreground="{StaticResource DarkTextBrush}" VerticalAlignment="Bottom" Margin="0" />                        
                    </StackPanel>
                    
                    
                    <Image x:Name="PART_MinimizeButton" Grid.Column="2" Grid.RowSpan="2" Source="/Images/WindowTitleBar/MinimizeButton.gif" Stretch="None" VerticalAlignment="Top" Margin="0,2,2,0" MouseDown="PART_MinimizeButton_MouseDown"/>


                    <Menu 
                        Style="{StaticResource TopMenu}"
                        Margin="3,0,0,4"
                        Grid.Column="0" Grid.Row="1">
                                                                        
                        <MenuItem Header="{x:Static props:Resources.New_Project}"
                                  Style="{StaticResource TopMenuItem}"
                                  BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="SCRUM_MASTER"
                                  MenuItem.Click="NewProject_Click"
                                  ItemContainerStyle="{StaticResource TopMenu_SubmenuItemContainerStyle}"
                                  ItemsSource="{Binding Source={StaticResource ProjectCategoryList}}"/>

                        <MenuItem Header="{x:Static props:Resources.Edit}" Style="{StaticResource TopMenuItem}">
                            <MenuItem Header="{x:Static props:Resources.Discard_Changes}"
                                      Command="ApplicationCommands.Undo"
                                      Style="{StaticResource TopMenuItem}"/>
                            <Separator/>
                            <MenuItem Header="{x:Static props:Resources.Commit_Changes}"                                      
                                      Command="ApplicationCommands.Save"
                                      Style="{StaticResource TopMenuItem}">
                                <MenuItem.Icon>
                                    <Image Source="/Images/Icons/Commit.png" Width="16" Height="16" Stretch="Uniform"/>
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="{x:Static props:Resources.Refresh}" Style="{StaticResource TopMenuItem}" Command="NavigationCommands.Refresh">
                                <MenuItem.Icon>
                                    <!-- ARRUMAR ICONE -->
                                    <Image Source="/Images/ToolBar/Refresh.png" Width="16" Height="16" Stretch="Uniform"/>
                                </MenuItem.Icon>
                            </MenuItem>
                        </MenuItem>
                        

                        <MenuItem Header="{x:Static props:Resources.Organization}"
                                  Style="{StaticResource TopMenuItem}">
                            <MenuItem Header="{x:Static props:Resources.Team_MMembers}" Style="{StaticResource TopMenuItem}" Click="teamMemberMenuItem_Click" />
                            <MenuItem Header="{x:Static props:Resources.Client_Contacts}" Style="{StaticResource TopMenuItem}" Click="productOwnersMenuItem_Click"/>
                            <Separator BadHabit_WPFTools:RoleChecker.RequiredVisibleRole="FACTORY_OWNER"/>
                            <MenuItem x:Name="TeamAllocationMenuItem" Header="{x:Static props:Resources.Team_Allocation}" Style="{StaticResource TopMenuItem}" Command="BadHabit_Factory:FactoryCommands.ViewTeamAllocation" />
                            <MenuItem x:Name="TeamEffortMenuItem" Header="{x:Static props:Resources.Team_Effort_Report}" Style="{StaticResource TopMenuItem}" Click="TeamEffortMenuItem_Click"/>
                            <MenuItem x:Name="ProjectPerformanceMenuItem" Header="{x:Static props:Resources.Project_Performance_Report}" Style="{StaticResource TopMenuItem}" Click="ProjectPerformanceMenuItem_Click"/>
                            
                        </MenuItem>
                        
                        <MenuItem Header="{x:Static props:Resources.Settings}" Click="MenuItem_Click" Style="{StaticResource TopMenuItem}"/>

                        <MenuItem Header="{x:Static props:Resources.Help}" Style="{StaticResource TopMenuItem}">
                            <MenuItem Header="{x:Static props:Resources.About_The_Scrum_Factory}" Style="{StaticResource TopMenuItem}" Click="aboutMenuItem_Click"/>
                            <MenuItem Header="{x:Static props:Resources.How_Do_I}" Style="{StaticResource TopMenuItem}" Click="helpMenuItem_Click">
                                <MenuItem.Icon>
                                    <Image Source="/Images/Icons/help.png" Width="16" Height="16" Stretch="Uniform"/>
                                </MenuItem.Icon>
                            </MenuItem>
                        </MenuItem>
                        <MenuItem Header="{x:Static props:Resources.Get_Out}" Click="MenuItemGetOut_Click" Style="{StaticResource TopMenuItem}"/>
                    </Menu>

                </Grid>
            </Border>

           
                <Grid 
                      Background="{StaticResource ApplicationBackgroundBrush}"
                    Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>



                    <BadHabit_Factory_Controls:ProjectTabControl
                        x:Name="tabControl"
                        Grid.Column="1"                                        
                        VerticalAlignment="Stretch"
                        Margin="0,3,0,0"
                        
                        Padding="0,0,0,0"/>


                <BadHabit_Factory_Controls:ProjectListBox
                        Grid.Column="0"                        
                        x:Name="projectListBox"                    
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        Margin="0,65,0,0"             
                        SelectedProjectChanged="projectListBox_SelectedProjectChanged"
                        
                    />


                <BadHabit_Factory_Controls:EffortBar
                    x:Name="effortBar"
                    Grid.Column="2"
                    Margin="0,3,0,0"
                    />




                <!--<Button
                        x:Name="commitButton"
                        Style="{StaticResource CommitButton}"
                        Grid.Column="1"                
                        Grid.Row="0"
                        HorizontalAlignment="Right" VerticalAlignment="Top"
                        Margin="5"
                        Command="ApplicationCommands.Save"/>-->

            </Grid>
        

            <StatusBar
                Grid.Row="2"
                BorderBrush="{StaticResource ProjectPanelBorderBrush}"
                BorderThickness="0,1,0,0"                
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch">

                <TextBlock x:Name="ConnectedTextBlock" Text="Disconnected"  Margin="0,0,10,0"/>
                <TextBlock x:Name="TotalProjectsTextBlock" Text="{Binding ElementName=projectListBox, Path=ProjectsCount, StringFormat={x:Static props:Resources.N_projects}}"/>
                
                <WrapPanel>
                    <Image  x:Name="roleStatusFACTORY_OWNER"                  
                        Margin="3,0,3,0"
                        Source="/Images/RoleType/FactoryOwner.gif"
                        ToolTip="{x:Static props:Resources.FACTORY_OWNER}"
                        Width="16" Height="16" Stretch="Uniform" VerticalAlignment="Center"/>
                    <Image  x:Name="roleStatusSCRUM_MASTER"
                            Margin="3,0,3,0"
                        Source="/Images/RoleType/ScrumMaster.gif"                        
                        ToolTip="{x:Static props:Resources.SCRUM_MASTER}"
                        Width="16" Height="16" Stretch="Uniform" VerticalAlignment="Center"/>
                    <Image  x:Name="roleStatusPRODUCT_OWNER"
                            Margin="3,0,3,0"
                        Source="/Images/RoleType/ProductOwner.gif"                        
                        ToolTip="{x:Static props:Resources.PRODUCT_OWNER}"
                        Width="16" Height="16" Stretch="Uniform" VerticalAlignment="Center"/>
                    <Image  x:Name="roleStatusCOMMERCIAL_GUY"
                            Margin="3,0,3,0"
                        Source="/Images/RoleType/CommercialGuy.gif"                        
                        ToolTip="{x:Static props:Resources.COMMERCIAL_GUY}"
                        Width="16" Height="16" Stretch="Uniform" VerticalAlignment="Center"/>
                    <Image  x:Name="roleStatusQUALITY_ASSURANCE"
                            Margin="3,0,3,0"
                        Source="/Images/RoleType/QUALITYASSURANCE.gif"                        
                        ToolTip="{x:Static props:Resources.QUALITY_ASSURANCE}"
                        Width="16" Height="16" Stretch="Uniform" VerticalAlignment="Center"/>
                    <Image  x:Name="roleStatusTEAM"
                            Margin="3,0,3,0"
                        Source="/Images/RoleType/Team.gif"                        
                        ToolTip="{x:Static props:Resources.Team}"
                        Width="16" Height="16" Stretch="Uniform" VerticalAlignment="Center"/>

                </WrapPanel>

                



            </StatusBar>

            <!-- Fancy stuff, when not enable goes gray -->
            <Rectangle Grid.RowSpan="3" Fill="Gray"  Opacity="0.5"  >
                <Rectangle.Style>
                    <Style>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding ElementName=window, Path=IsPopUpOpened}" Value="False">
                                <Setter Property="Rectangle.Visibility" Value="Hidden"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Rectangle.Style>
            </Rectangle>

        </Grid>
    </Border>
</BadHabit_WPFTools:ShapedWindow>
